/**
 * Created by Administrator on 2019/5/17/017.
 * 添加矩形
 */
import CZML_GENERALTOOLS_CLASS from "./../main/CZML_GENERALTOOLS_CLASS.js"

class CZML_Rectangle {
    constructor(viewer, id, name, points, fillColor, isFilled, isOutline, outlineColor) {
        this._viewer = viewer
        this.id = id
        this.name = name
        this.points = points
        this.fillColor = fillColor
        this.isFilled = isFilled
        this.isOutline = isOutline
        this.outlineColor = outlineColor
        this.Rect = {
            id: id,
            name: name,
            rectangle: {
                show: true,
                height: 0,
                coordinates: { wsenDegrees: points },
                material: {
                    solidColor: {
                        color: {
                            rgba: fillColor
                        }
                    }
                },
                fill: isFilled,
                outline: isOutline,
                outlineColor: {
                    rgba: outlineColor
                }
            }
        }

        this.CZML_AddRectangle()
    }

    CZML_AddRectangle() {
        // 插入该数据对象
        const ret = CZML_GENERALTOOLS_CLASS.InsertModelObjectInformation(this.id, this.Rect, true)
        // 上图
        CZML_GENERALTOOLS_CLASS.Upper(this._viewer)
        return ret
    }
}
export default CZML_Rectangle
